package com.happyfamily.springboot.crowdsourcingplatform.service.pan.impl;

import com.happyfamily.springboot.crowdsourcingplatform.base.result.Results;
import com.happyfamily.springboot.crowdsourcingplatform.dao.pan.PurchaseDao;
import com.happyfamily.springboot.crowdsourcingplatform.model.Work;
import com.happyfamily.springboot.crowdsourcingplatform.service.pan.PurchaseService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;



/**
 * @Author Administrator
 * @create 2020/02/23 01:25
 */
@Service
public class PurchaseServiceImpl implements PurchaseService
{
	@Autowired
	private PurchaseDao purchaseDao;



	@Override
	public Results<Work> getAllWorksByPage(Integer startPosition, Integer limit)
	{
		return Results.success(purchaseDao.countAllWorks().intValue(), purchaseDao.getAllWorksByPage(startPosition, limit));

	}

	@Override
	public Work getWorkById(Integer wid)
	{
		return purchaseDao.getWorkById(wid);
	}

	@Override
	public int updateWork(String wid, String account)
	{
		return purchaseDao.updateWorkByWid(wid,account);
	}

	@Override
	public Integer getOrdesById(String wid)
	{
		return purchaseDao.getOrdesById(wid);
	}
}
